home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-10-03 | 1.8 KB | 73 lines |
- package com.symantec.itools.frameworks.wizard;
-
-
- import com.sun.java.swing.JPanel;
- import java.awt.Insets;
- import java.awt.Color;
- import com.sun.java.swing.JComponent;
- import java.awt.BorderLayout;
- import java.awt.Graphics;
- import java.awt.Dimension;
-
-
- /**
- * @author Symantec Internet Tools Division
- * @version 1.0
- * @since VCafe 3.0
- */
-
- public class BorderPanel extends JComponent
- {
- public BorderPanel(JComponent borderThis, int leftBorder,
- int rightBorder, int topBorder,
- int bottomBorder, Color fillColor)
- {
- setLayout(new BorderLayout());
- add(borderThis, "Center");
- inset = new Insets(topBorder, leftBorder, bottomBorder, rightBorder);
- color = new Color(fillColor.getRGB());
- }
-
- public BorderPanel(JComponent borderThis, Insets inset, Color fillColor)
- {
- setLayout(new BorderLayout());
- add(borderThis, "Center");
- this.inset = (Insets) inset.clone();
- color = new Color(fillColor.getRGB());
- }
-
- /**
- * @since VCafe 3.0
- */
- public Insets getInsets()
- {
- return inset;
- }
-
- /**
- * @param g TODO
- * @since VCafe 3.0
- */
- public void paint (Graphics g)
- {
- Dimension mySize = getSize();
- g.setColor(color);
- // Top inset
- g.fillRect(0, 0, mySize.width, inset.top);
-
- // Left inset
- g.fillRect(0, 0, inset.left, mySize.height);
-
- // right inset
- g.fillRect((mySize.width - inset.right), 0, inset.right, mySize.height);
-
- // bottom inset
- g.fillRect(0, (mySize.height - inset.bottom), mySize.width, mySize.height);
-
- super.paint(g);
- }
- private Insets inset = null;
- private Color color = null;
- }
-
-